home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol C-14 / Vol C-14.iso / games / snackes.swf / scripts / FLabelSymbol.as < prev    next >
Text File  |  2012-04-23  |  1KB  |  52 lines

  1. _global.FLabelClass = function()
  2. {
  3.    if(this.hostComponent == undefined)
  4.    {
  5.       this.hostComponent = this._parent.controller != undefined ? this._parent.controller : this._parent;
  6.    }
  7.    if(this.customTextStyle == undefined)
  8.    {
  9.       if(this.hostComponent.textStyle == undefined)
  10.       {
  11.          this.hostComponent.textStyle = new TextFormat();
  12.       }
  13.       this.textStyle = this.hostComponent.textStyle;
  14.       this.enable = true;
  15.    }
  16. };
  17. FLabelClass.prototype = new MovieClip();
  18. Object.registerClass("FLabelSymbol",FLabelClass);
  19. FLabelClass.prototype.setLabel = function(label)
  20. {
  21.    var val = this.hostComponent.styleTable.embedFonts.value;
  22.    if(val != undefined)
  23.    {
  24.       this.labelField.embedFonts = val;
  25.    }
  26.    this.labelField.setNewTextFormat(this.textStyle);
  27.    this.labelField.text = label;
  28.    this.labelField._height = this.labelField.textHeight + 2;
  29. };
  30. FLabelClass.prototype.setSize = function(width)
  31. {
  32.    this.labelField._width = width;
  33. };
  34. FLabelClass.prototype.setEnabled = function(enable)
  35. {
  36.    this.enable = enable;
  37.    var tmpColor = this.hostComponent.styleTable[!enable ? "textDisabled" : "textColor"].value;
  38.    if(tmpColor == undefined)
  39.    {
  40.       tmpColor = !enable ? 8947848 : 0;
  41.    }
  42.    this.setColor(tmpColor);
  43. };
  44. FLabelClass.prototype.getLabel = function()
  45. {
  46.    return this.labelField.text;
  47. };
  48. FLabelClass.prototype.setColor = function(col)
  49. {
  50.    this.labelField.textColor = col;
  51. };
  52.